<template>
	<view class="uni-popup-share">
		<view class="uni-share-title">
			<text class="uni-share-title-text">{{shareTitleText}}</text>
			<image src="/static/icons/Close.svg" class="CloseImg" @click="close"></image>
			</view>
		<view class="uni-share-content">
			<view class="uni-share-content-box">
				<view class="uni-share-content-item" v-for="(item,index) in bottomData" :key="index"
					@click.stop="select(item,index)">
					<image class="uni-share-image" :src="item.icon" mode="aspectFill"></image>
					<text class="uni-share-text">{{item.text}}</text>
				</view>

			</view>
		</view>
<!-- 		<view class="uni-share-button-box">
			<button class="uni-share-button" @click="close">{{cancelText}}</button>
		</view> -->
	</view>
</template>

<script>
	import popup from '../uni-popup/popup.js'
	import {
		initVueI18n
	} from '@dcloudio/uni-i18n'
	import messages from '../uni-popup/i18n/index.js'
	const {
		t
	} = initVueI18n(messages)
	export default {
		name: 'UniPopupShare',
		mixins: [popup],
		emits: ['select'],
		props: {
			title: {
				type: String,
				default: ''
			},
			beforeClose: {
				type: Boolean,
				default: false
			}
		},
		data() {
			return {
				bottomData: [{
						text: '特价活动',
						icon: '/static/icons/XianShiZeKou.svg',
						name: 'xianshi'
					},
					{
						text: '优惠券',
						icon: '/static/icons/ShouJianYouHui.svg',
						name: 'shoujian'
					},
					{
						text: '满折满减',
						icon: '/static/icons/ManJianBaoYou.svg',
						name: 'manjian'
					},
					{
						text: '第N件促销',
						icon: '/static/icons/DiErJian.svg',
						name: 'dierjian'
					},
					{
						text: '会员活动',
						icon: '/static/icons/vip_active.svg',
						name: 'vipactive'
					},
					// { 
					// 	text: '百度',
					// 	icon: 'https://vkceyugu.cdn.bspapp.com/VKCEYUGU-dc-site/1ec6e920-50bf-11eb-8a36-ebb87efcf8c0.png',
					// 	name: 'copy'
					// },
					// {
					// 	text: '其他',
					// 	icon: 'https://vkceyugu.cdn.bspapp.com/VKCEYUGU-dc-site/2e0fdfe0-50bf-11eb-b997-9918a5dda011.png',
					// 	name: 'more'
					// }
				]
			}
		},
		created() {},
		computed: {
			cancelText() {
				return t("uni-popup.cancel")
			},
			shareTitleText() {
				return this.title || t("uni-popup.shareTitle")
			}
		},
		methods: {
			/**
			 * 选择内容
			 */
			select(item, index) {
				this.$emit('select', {
					item,
					index
				})
				this.close()

			},
			/**
			 * 关闭窗口
			 */
			close() {
				if (this.beforeClose) return
				this.popup.close()
			}
		}
	}
</script>
<style lang="scss">
	.uni-popup-share {
		background-color: #fff;
		border-top-left-radius: 5vw;
		border-top-right-radius: 5vw;
		padding-top: 1vh;
	}
	.CloseImg{
		    width: 37rpx;
		    height: 36rpx;
		    position: absolute;
		    right: 24rpx;
		    margin-bottom: 18rpx;
	}
	.uni-share-title {
		/* #ifndef APP-NVUE */
		display: flex;
		/* #endif */
		flex-direction: row;
		align-items: center;
		justify-content: center;
		height: 100rpx;
	}

	.uni-share-title-text {
		font-size: 34rpx;
		color: black;
		// color: #666;
		
		
	}

	.uni-share-content {
		/* #ifndef APP-NVUE */
		display: flex;
		/* #endif */
		flex-direction: row;
		justify-content: center;
		padding-top: 36rpx;
		
		    height: 40vh;
	}

	.uni-share-content-box {
		/* #ifndef APP-NVUE */
		display: flex;
		/* #endif */
		flex-direction: row;
		flex-wrap: wrap;
		width: 720rpx;

		align-items: flex-start;
	}

	.uni-share-content-item {
		width: 180rpx;
		/* #ifndef APP-NVUE */
		display: flex;
		/* #endif */
		flex-direction: column;
		justify-content: center;
		padding: 20rpx 0;
		align-items: center;
	}

	.uni-share-content-item:active {
		background-color: #f5f5f5;
	}

	.uni-share-image {
		width: 80rpx;
		height: 80rpx;
	}

	.uni-share-text {
		margin-top: 20rpx;
		font-size: 28rpx;
		color: #3B4144;
	}

	.uni-share-button-box {
		/* #ifndef APP-NVUE */
		display: flex;
		/* #endif */
		flex-direction: row;
		padding: 20rpx 30rpx;
	}

	.uni-share-button {
		flex: 1;
		border-radius: 100rpx;
		color: #666;
		font-size: 32rpx;
	}

	.uni-share-button::after {
		border-radius: 100rpx;
	}
</style>
